package com.example.win.android_banduyujia.peopleactivity.adapter;

import android.content.Context;
import android.support.v7.widget.RecyclerView;
import android.view.View;
import android.view.ViewGroup;
import android.widget.RelativeLayout;

import com.example.win.android_banduyujia.R;
import com.example.win.android_banduyujia.entity.OrderlistEntity;
import com.example.win.android_banduyujia.venuesactivity.activity.openactivity.VenuesMyOrderActivity;

import java.util.List;

/**
 * Created by Win on 2015/8/31.
 */
public class MyOrderAdapter extends RecyclerView.Adapter {

    private List<OrderlistEntity>  mListDatas;
    private RecyclerView listDatas;
    private Context  mContext;

    public MyOrderAdapter(Context context, List<OrderlistEntity>  datas) {
            this.mContext = context;
            this.mListDatas = datas;
    }

    public MyOrderAdapter(VenuesMyOrderActivity context, OrderlistEntity mOrderlist) {

    }

    @Override
    public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup viewGroup, int i) {
        View view = View.inflate(viewGroup.getContext(), R.layout.view_order_list_item, null);

        return new OrderListViewHolder(view);
    }

    @Override
    public void onBindViewHolder(RecyclerView.ViewHolder holder, int i) {
       // ((ViewCreateMethods)holder).fillViewHolderWithData(null);
    }

    @Override
    public int getItemCount() {
        if(mListDatas != null){
            return mListDatas.size();
        }
        return 0;
    }

    public void setListDatas(List<OrderlistEntity>  datas) {
        this.mListDatas = datas;
        super.notifyDataSetChanged();
    }

    private interface ViewCreateMethods{
        void fillViewHolderWithData(Object o);
    }

    private class OrderListViewHolder extends RecyclerView.ViewHolder implements View.OnClickListener {

        private Context   mContext;
        private RelativeLayout  RelaLayout;

        public OrderListViewHolder(View itemview) {
            super(itemview);
            //itemview.setOnClickListener(this);
            RelaLayout = (RelativeLayout) itemview.findViewById(R.id.layout_linear_order_list);
            RelaLayout.setOnClickListener(this);
        }

        @Override
        public void onClick(View v) {
            switch (v.getId()){
                case R.id.layout_linear_order_list:

                    break;
            }
        }
    }

}
